<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>主页面</title>
    <script src="/html/js/axios.min.js"></script>
    <script src="/html/js/util.js"></script>
    <script>
        window.onload=function (){
            //得到错误信息
            let info = getQuery("errorInfo");
            if (info == "noland"){
                $("errorDiv").innerHTML="对不起,请先登录";
            }else if (info =="nograde"){
                $("errorDiv").innerHTML="对不起,你没有权限";
            }
        }
        async function land(){
            //登录
            var info = await ajaxGet("/user/login",{
                name:$("name").value,
                pwd:$("pwd").value
            });
            if (info == "no"){
                $("errorDiv").innerHTML="登录失败";
            }else if (info == "顾客"){
                location.href="index.html";
            }else if (info == "管理员"){
                location.href="/html/manager/pressOrder.html";
            }else if (info == "送货员"){
                location.href="/html/send/sendOrder.html"
            }else if (info == "经理"){
                location.href="/html/boss/bossIndex.html"
            }
        }
    </script>
</head>
<body>
<div style="color:red; font-size: 12px;" id="errorDiv"></div>
    用户名：<input type="text" id="name"><br>
    密&emsp;码：<input type="password" id="pwd"><br>
    <input type="button" value="登录" onclick="land()">
</body>
</html>